<%@page import="com.sfd.entity.Book"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" />
<title>图书档案</title>
<!-- 去超链接下划线 -->
<style type="text/css">
	a{
		 text-decoration:none;
	}
</style>
<link rel="stylesheet" type="text/css" href="../../skin/css/base.css">
	<script type="text/javascript" src="../../js/jquery.js"></script>
	<script type="text/javascript" src="../../js/thickbox_plus.js"></script>
	<script src="../../js/dt.js"></script>
	<link rel="stylesheet" type="text/css" href="../../css/thickbox.css" />
	<script language="javascript">
		var message=request.getAttribute("message");
		if(message!=null){
			alert();
		}
		function viewArc(aid) {
			if (aid == 0)
				aid = getOneItem();
			window.open("archives.asp?aid=" + aid + "&action=viewArchives");
		}
		function editArc(aid) {
			if (aid == 0)
				aid = getOneItem();
			location = "archives.asp?aid=" + aid + "&action=editArchives";
		}
		function updateArc(aid) {
			location.reload();
		}
		function checkArc(aid) {
			var qstr = getCheckboxItem();
			if (aid == 0)
				aid = getOneItem();
			location = "archives.asp?aid=" + aid
					+ "&action=checkArchives&qstr=" + qstr + "";
		}
		function moveArc(aid) {
			var qstr = getCheckboxItem();
			if (aid == 0)
				aid = getOneItem();
			location = "archives.asp?aid=" + aid + "&action=moveArchives&qstr="
					+ qstr + "";
		}
		function adArc(aid) {
			var qstr = getCheckboxItem();
			if (aid == 0)
				aid = getOneItem();
			location = "archives.asp?aid=" + aid
					+ "&action=commendArchives&qstr=" + qstr + "";
		}
		function delArc(aid) {
			var qstr = getCheckboxItem();
			if (aid == 0)
				aid = getOneItem();
			location = "archives.asp?aid=" + aid + "&action=delArchives&qstr="
					+ qstr + "";
		}

		//获得选中文件的文件名
		function getCheckboxItem() {
			var allSel = "";
			if (document.form2.id.value)
				return document.form2.id.value;
			for (i = 0; i < document.form2.id.length; i++) {
				if (document.form2.id[i].checked) {
					if (allSel == "")
						allSel = document.form2.id[i].value;
					else
						allSel = allSel + "`" + document.form2.id[i].value;
				}
			}
			return allSel;
		}

		//获得选中其中一个的id
		function getOneItem() {
			var allSel = "";
			if (document.form2.id.value)
				return document.form2.id.value;
			for (i = 0; i < document.form2.id.length; i++) {
				if (document.form2.id[i].checked) {
					allSel = document.form2.id[i].value;
					break;
				}
			}
			return allSel;
		}
		function selAll() {
			alert(document.form2.id1.length);
			for (i = 0; i < document.form2.id1.length; i++) {
				if (!document.form2.id1[i].checked) {
					document.form2.id1[i].checked = true;
				}
			}
		}
		function isone() {
			var count = 0;
			for (i = 0; i < document.form2.id.length; i++) {
				if (document.form2.id[i].checked) {
					count++;

				}
			}
			if (count < 1) {
				alert("没有选择数据！");
				return;
			}

			if (count > 1) {
				alert("只可选择一条信息");
				return;
			} else {
				location = "roleset.html?height=400;width=300";
			}
		}
		function noone() {
			alert(11);
//			var count = 0;
///			for (i = 0; i < document.form2.id.length; i++) {
//				if (document.form2.id[i].checked) {
//					count++;
///				}
//			}
//			if (count == 0) {
//				alert("您没有选择删除目标！");
//				return;
	//		} else {

				//document.getElementById("actioncode").value="deletebooks"
				//alert(document.getElementById("actioncode").value);
//				document.forms.form2.submit();
//				alert("您已成功删除目标！");
				
//				location.reload();

			}
		}
		function noSelAll() {
			for (i = 0; i < document.form2.id.length; i++) {
				if (document.form2.id[i].checked) {
					document.form2.id[i].checked = false;
				}
			}
		}
		function gotoPage(){
			var a = document.getElementById("page");
			if(!isNaN(a.item(0).value)){
				document.getElementById("showbooklist").value="showBookList";
				document.forms.form2.submit();
			}else{
				alter("非法字符！");
				
		}
		
	
	</script>
	<style type="text/css">
.t1 {
	text-align: center;
}

.STYLE2 {
	font-size: 16px
}
</style>
</head>
<body leftmargin="0"  bgcolor="#0094D4">

	<!--  快速转换位置按钮  -->
	<!--  内容列表   -->
	<form name="form2" action="managerServlet?actioncode=deletebooks" method="post">

		<table width="100%" border="0" cellpadding="2" cellspacing="1" 
			bgcolor="#D1DDAA" align="center" style="margin-top:-5px;margin-right:-5px;'">
			
			<tr bgcolor="#DAE0F1">
				<td height="24" colspan="11" align="center"><span class="t1">&nbsp;
				<span
						class="STYLE2">图书信息总览</span>
				</span>
				</td>
			</tr>
			<tr align="center" bgcolor="#FAFAF1" height="22">
				<td width="9%" align="center">选择</td>

				<td width="10%" align="center"><span class="t1">编号</span>
				</td>
				<td width="11%" align="center"><span class="t1">书名</span>
				</td>
				<td width="10%" align="center"><span class="t1">作者</span>
				</td>
				<td width="11%" align="center"><span class="t1">出版社</span>
				</td>
				<td width="14%" align="center"><span class="t1">入馆时间</span>
				</td>
				<td width="9%" align="center"><span class="t1">状态</span>
				</td>
				<td width="9%" align="center"><span class="t1">单价</span>
				</td>
				<td colspan="2" align="center">基本操作</td>
			</tr>

			<%
				List list_all_books = (List) request.getAttribute("list_all_books");

				System.out.println(list_all_books.size());

				for (int i = 0; i < list_all_books.size(); i++) {

					Book book = (Book) list_all_books.get(i);
			%>

			<tr align='center' bgcolor="#FFFFFF"
				onMouseMove="javascript:this.bgColor='#FCFDEE';"
				onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
				<td align="center"><input type="checkbox" id="id" class="np"
					name="bookID" value=<%=book.getBookID()%> />
				</td>
				<td align="center"><span class="t1"><%=book.getBookID()%></span>
				</td>
				<td align="center"><%=book.getBookName()%></td>
				<td align="center"><%=book.getAuthor()%></td>
				<td align="center"><%=book.getPublish()%></td>
				<td align="center"><%=book.getBuyTime()%></td>
				<td align="center"><%=book.getBookStatus()%></td>
				<td align="center"><span class="t1"><%=book.getBookPrice()%></span>
				</td>

				<td align="center"><span class="t1">
				   <a href="/librarysystem/managerServlet?actioncode=querydetail&bookID=<%=book.getBookID()%>">详情</a>
				</span>
				</td>
				<td align="center"><span class="t1">
				   <a href="/librarysystem/editServlet?bookID=<%=book.getBookID()%>">编辑</a>
				</span>
				</td>
				<inpute type="hidden" id="actioncode" name="actioncode"value="gsdg" />

				<%
					}
				%>
		  <tr bgcolor="#FAFAF1">
					<td height="28" colspan="11" align="center"><span class="t1">&nbsp;
							<a href="javascript:selAll()" class="coolbg">&nbsp;全选&nbsp;</a> <a
							href="javascript:noSelAll()" class="coolbg">&nbsp;取消&nbsp;</a> <a
							href="javascript:updateArc()" class="coolbg">&nbsp;更新&nbsp;</a>
							
							<!-- <a href="javascript:updateArc(0)" class="coolbg">&nbsp;下一页&nbsp;</a> -->
							<a href="javascript:noone()" class="coolbg">&nbsp;删除&nbsp;</a> 
					</td>
		  </tr>
	
				<tr align="right" bgcolor="#EEF4EA">
						<td height="49" colspan="11" align="center"><span class="t1">
						第<input type="text"  name="page" size="5"/>&nbsp;页&nbsp;
							<a href="#"  onclick="gotoPage()" class="coolbg">跳转</a>
							
					 			<inpute type="hidden" id="showbooklist"  name="actioncode" value="gsdg" />
					 			
							</span>					
						</td>
				</tr>
	  </table>

	</form>

	<span class="t1"> <!--  搜索表单  --> </span>
</body>
</html>
